<html>
    <head>
        <title>Node.JS Email Application</title>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script>// <![CDATA[
            $(document).ready(function(){
                var from,to,subject,text;
                $("#send_email").click(function(){      
                    to=$("#to").val();
                    subject=$("#subject").val();
                    text=$("#content").val();
                    $("#message").text("Sending E-mail...Please wait");
                    $.get("http://localhost:3000/send",{to:to,subject:subject,text:text},function(data){
                        if(data=="sent")
                        {
                            $("#message").empty().html("Email is been sent at "+to+" . Please check inbox !");
                            $("#to").val('');
                            $("#subject").val('');
                            $("#content").val('');
                        } else {
                            $("#message").empty().html("error");
                        }

                    });
                });
            });
     </script>
    </head>
    <body>
        <div id="container">
            <h1>Sample Mailer In Node.JS</h1>
            <input id="to" type="text" placeholder="Enter E-mail ID where you want to send" /> <br>
            <input id="subject" type="text" placeholder="Write Subject" /> <br>
            <textarea id="content" cols="40" rows="5" placeholder="Write what you want to send"></textarea> <br>
            <button id="send_email">Send Email</button><br>
            <span id="message"></span><br>
        </div>
    </body>
</html>
